package cc.md888.app.infr.ip.convert;

import cc.md888.app.infr.ip.IpInfoVO;
import cc.md888.app.infr.ip.provider.ip123.IpInfoFromIp123VO;
import com.alibaba.fastjson.JSON;

public class Ip123Convert {


    public IpInfoVO convert(String payload) {
        IpInfoFromIp123VO ipInfoFromIp123VO = JSON.parseObject(payload, IpInfoFromIp123VO.class);
        IpInfoVO infoDTO = new IpInfoVO();
        infoDTO.setIp(ipInfoFromIp123VO.getIp());
        infoDTO.setCountryCode(ipInfoFromIp123VO.getCountryCode());
        infoDTO.setRegion(ipInfoFromIp123VO.getRegion());
        infoDTO.setCity(ipInfoFromIp123VO.getCity());
        infoDTO.setAsnCode(ipInfoFromIp123VO.getAsn());
        infoDTO.setAsnName(ipInfoFromIp123VO.getOrganization());
        infoDTO.setTimeZone(ipInfoFromIp123VO.getTimezone());
        infoDTO.setLat(ipInfoFromIp123VO.getLatitude());
        infoDTO.setLng(ipInfoFromIp123VO.getLongitude());
        return infoDTO;
    }
}
